package com.zhumei.keyscale.adapter;

import android.annotation.SuppressLint;

import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.zhumei.keyscale.entity.vo.*;
import com.chad.library.adapter.base.*;
import java.util.*;
import com.zhumei.keyscale.util.*;
import com.blankj.utilcode.util.*;
import androidx.recyclerview.widget.*;

public class OrderAdapter extends BaseQuickAdapter<GoodsDetailVo, BaseViewHolder>
{
    private int defaultFocus;
    
    @SuppressLint("ResourceType")
    public OrderAdapter(final List<GoodsDetailVo> list) {
        super(2131427383, list);
        if (list.isEmpty()) {
            this.defaultFocus = 0;
            return;
        }
        this.defaultFocus = list.size() - 1;
    }
    
    @SuppressLint("ResourceType")
    @Override
    protected void convert(final BaseViewHolder baseViewHolder, final GoodsDetailVo goodsDetailVo) {
        final int adapterPosition = ((RecyclerView.ViewHolder)baseViewHolder).getAdapterPosition();
        @SuppressLint("ResourceType") final BaseViewHolder setText = baseViewHolder.setText(2131231231, goodsDetailVo.getGoodsName());
        final StringBuilder sb = new StringBuilder();
        sb.append(adapterPosition + 1);
        sb.append("");
        @SuppressLint("ResourceType") final BaseViewHolder setText2 = setText.setText(2131231278, sb.toString());
        final StringBuilder sb2 = new StringBuilder();
        sb2.append(goodsDetailVo.getPrice().doubleValue());
        sb2.append("");
        @SuppressLint("ResourceType") final BaseViewHolder setText3 = setText2.setText(2131231232, sb2.toString());
        final StringBuilder sb3 = new StringBuilder();
        sb3.append(goodsDetailVo.getWeight());
        sb3.append("");
        @SuppressLint("ResourceType") final BaseViewHolder setText4 = setText3.setText(2131231277, sb3.toString());
        final StringBuilder sb4 = new StringBuilder();
        sb4.append(goodsDetailVo.getTotalPrice());
        sb4.append("");
        setText4.setText(2131231263, sb4.toString());
        if (adapterPosition % 2 == 0) {
            baseViewHolder.itemView.setBackgroundColor(ResourceManager.getColResource(2131034147));
        }
        else {
            baseViewHolder.itemView.setBackgroundColor(ResourceManager.getColResource(2131034148));
        }
        if (this.defaultFocus == adapterPosition) {
            baseViewHolder.getView(2131230980).setVisibility(0);
            return;
        }
        baseViewHolder.getView(2131230980).setVisibility(8);
    }
    
    public void setSelPos(final int defaultFocus) {
        final StringBuilder sb = new StringBuilder();
        sb.append("pos =>");
        sb.append(defaultFocus);
        LogUtils.d(sb.toString());
        this.defaultFocus = defaultFocus;
        ((RecyclerView.Adapter)this).notifyDataSetChanged();
    }
}
